//
//  AuditSectinoHeader.swift
//  ANOA
//
//  Created by 邱仙凯 on 2022/3/8.
//  Copyright © 2022 zwb. All rights reserved.
//

import UIKit
 
class ZyaAuditSectinoHeader:UITableViewHeaderFooterView {
    
    var deleteClo:(()->())?
    lazy var lab:UILabel = {
       let v = UILabel()
        v.font = UIFont.systemFont(ofSize: 17)
        v.textColor = .black
        return v
    }()
    lazy var del:UIButton = {
       let v = UIButton()
        v.setBackgroundImage(UIImage(named: "del"), for: .normal)
         return v
    }()
    lazy var arrow:UIButton = {
       let v = UIButton()
        v.setBackgroundImage(UIImage(named: "zk_1"), for: .normal)
         return v
    }()
    
    lazy  var bg:UIView = {
        let v = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        v.layer.masksToBounds = true
        return v
    }()
    private lazy var line:UIView = {
        let v = UIView()
        v.backgroundColor = UIColor(kshex:"#cccccc")
        return v
    }()
    
    override init(reuseIdentifier: String?) {
        super.init(reuseIdentifier: reuseIdentifier)
        
         self.contentView.backgroundColor = Theme.awModuleBgColor
        self.contentView.addSubview(bg)
        bg.snp.makeConstraints { make in
            make.left.equalTo(self.contentView).offset(6)
            make.top.equalTo(self.contentView).offset(11)
            make.right.equalTo(self.contentView).offset(-6)
            make.bottom.equalTo(self.contentView)
        }
        bg.addSubview(lab)
        bg.addSubview(arrow)
        bg.addSubview(del)
        
        
        bg.addSubview(line)
        line.snp.makeConstraints { make in
            make.left.equalTo(bg)
            make.right.equalTo(bg)
            make.height.equalTo(1)
            make.bottom.equalTo(bg).offset(0.5)
        }
        
         lab.snp.makeConstraints { make in
           make.centerX.equalTo(bg)
           make.centerY.equalTo(bg)
       }
        del.addTouchUpInSideAction { _ in
            if let clo = self.deleteClo {
                clo()
            }
        }
        del.snp.makeConstraints { make in
            make.left.equalTo(bg).offset(8)
            make.centerY.equalTo(bg)
            make.width.equalTo(23)
            make.height.equalTo(25)
        }
     
        arrow.snp.makeConstraints { make in
            make.right.equalTo(bg).offset(-8)
            make.centerY.equalTo(bg)
            make.width.equalTo(15)
            make.height.equalTo(15)
        }
        
    }
  
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
